// NewElementDlg.cpp : implementation file
//

#include "stdafx.h"
#include "TSG.h"
#include "NewElementDlg.h"


// CNewElementDlg dialog

IMPLEMENT_DYNAMIC(CNewElementDlg, CDialog)

CNewElementDlg::CNewElementDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CNewElementDlg::IDD, pParent)
	, m_szName(_T(""))
	, m_szIndentifier(_T(""))
	, m_szNumOfBits(_T(""))
	, m_szValue(_T(""))
{

}

CNewElementDlg::~CNewElementDlg()
{
}

void CNewElementDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_COMBO_INDENTIFIER, m_Indentifier);
	DDX_Text(pDX, IDC_EDIT_NAME, m_szName);
	DDV_MaxChars(pDX, m_szName, 32);
	DDX_CBString(pDX, IDC_COMBO_INDENTIFIER, m_szIndentifier);
	DDX_Text(pDX, IDC_EDIT_BITS, m_szNumOfBits);
	DDV_MaxChars(pDX, m_szNumOfBits, 3);
	DDX_Text(pDX, IDC_EDIT_VALUE, m_szValue);
	DDV_MaxChars(pDX, m_szValue, 8);
}


BEGIN_MESSAGE_MAP(CNewElementDlg, CDialog)
	
END_MESSAGE_MAP()


// CNewElementDlg message handlers

BOOL CNewElementDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  Add extra initialization here
	m_Indentifier.AddString(_T("bslbf"));
	m_Indentifier.AddString(_T("uimsbf"));
	m_Indentifier.AddString(_T("rpchof"));

	UpdateData(FALSE);

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}


void CNewElementDlg::OnOK()
{
	// TODO: Add your specialized code here and/or call the base class
	UpdateData(TRUE);

	if(m_szName == "")
	{
		AfxMessageBox(_T("The Name CANNOT be NULL!"));
		return;
	}
	
	CDialog::OnOK();
}
